#include "threadpool.hpp"
#include <iostream>
#include <memory>
#include <ctime>
using namespace std;

int main() {
    srand((uint64_t)time(nullptr) ^ getpid() ^ pthread_self());
    unique_ptr<ThreadPool<Task>> tp(new ThreadPool<Task>());
    // 启动线程池
    tp->Start();

    while (true) {
        Task t;
        t._code = 0;
        t._x = rand() % 100;
        usleep(1000);
        t._y = rand() % 100;
        usleep(1000);
        t._op = opers[rand() % opers.size()];
        tp->Push(t);
        // cout << "main thread productor done a Task : " << t.TaskToString() << endl;
        sleep(1);
    }


    return 0;
}